ispell.el (ispell-region): Do not prefix sent string by comment in autoconf mode
authorAgustin Martin <agustin.martin@hispalinux.es>
Tue, 6 Nov 2012 16:33:56 +0000 (17:33 +0100)
committerAgustin Martin <agustin.martin@hispalinux.es>
Tue, 6 Nov 2012 16:33:56 +0000 (17:33 +0100)
 This commit changes some of the `in-comment' ocurrences to more specific
 `add-comment', set only if comment prefix is to be added.

 When in comment, old code prefixed string by comment string to let ispell
 know this is part of a comment string.

 This is only supported in some modes. In particular, this is not supported in
 autoconf mode where adding the comment string messes everything up because
 ispell tries to spellcheck the `dnl' string header causing misalignments in
 some cases (debbugs.gnu.org: #12768).

lisp/ChangeLog
lisp/textmodes/ispell.el

index 808e2f66406f049fad7450c1f7484e50748bdf72..08acc4badaf03e405b915faab8134750527c1a35 100644 (file)
@@ -13,6 +13,9 @@
        (ispell-buffer-with-debug): New function that creates a debugging
        buffer and calls `ispell-buffer' with debugging enabled.
 
+       * textmodes/ispell.el (ispell-region): Do not prefix sent string by
+       comment in autoconf mode. (Bug#12768)
+
 2012-11-06  Dmitry Antipov  <dmantipov@yandex.ru>
 
        * emacs-lisp/byte-opt.el (toplevel): Add compare-window-configurations,
index 424a83c1713a18d8d7dcf50d944d29595783addd..f667525397c79cb08cd3d83133e5e634ade2ccf4 100644 (file)
@@ -3006,15 +3006,23 @@ amount for last line processed."
                                     (marker-position ispell-region-end))))
                (let* ((ispell-start (point))
                       (ispell-end (min (point-at-eol) reg-end))
+                      ;; See if line must be prefixed by comment string to let ispell know this is
+                      ;; part of a comment string.  This is only supported in some modes.
+                      ;; In particular, this is not supported in autoconf mode where adding the
+                      ;; comment string messes everything up because ispell tries to spellcheck the
+                      ;; `dnl' string header causing misalignments in some cases (debbugs.gnu.org: #12768).
+                      (add-comment (and in-comment
+                                        (not (string= in-comment "dnl "))
+                                        in-comment))
                       (string (ispell-get-line
-                               ispell-start ispell-end in-comment)))
+                               ispell-start ispell-end add-comment)))
                  (ispell-print-if-debug
                   (format
-                   "ispell-region: string pos (%s->%s), eol: %s, [in-comment]: [%s], [string]: [%s]\n"
-                   ispell-start ispell-end (point-at-eol) in-comment string))
-                 (if in-comment                ; account for comment chars added
-                     (setq ispell-start (- ispell-start (length in-comment))
-                           in-comment nil))
+                   "ispell-region: string pos (%s->%s), eol: %s, [in-comment]: [%s], [add-comment]: [%s], [string]: [%s]\n"
+                   ispell-start ispell-end (point-at-eol) in-comment add-comment string))
+                 (if add-comment               ; account for comment chars added
+                     (setq ispell-start (- ispell-start (length add-comment))
+                           add-comment nil))
                  (setq ispell-end (point)) ; "end" tracks region retrieved.
                  (if string            ; there is something to spell check!
                      ;; (special start end)